import requests
from lxml import etree

base_url = "https://www.hbjcxy.com/"
# 请求
response = requests.get(base_url)
# 设置编码方式
response.encoding = "utf-8"
# 节点树
node = etree.HTML(response.text)
imgs = node.xpath("//img/@src")
print(imgs)
imgs = [base_url+img for img in imgs]
print(imgs)
# 循环保存
for img in imgs:
    response = requests.get(img)
    with open("图片/"+img.split("/")[-1],"wb+") as f:
        f.write(response.content)
